import Vue from 'vue';
import Vuex from 'vuex';
import Router from '@/router/index';
import syncStorage from './plugins/syncStorage';
import examine from '@/store/modules/examine';
import functions from '@/store/modules/functions';
import matlab from '@/store/modules/matlab';
import user from '@/store/modules/user';
Vue.use(Vuex);

export default new Vuex.Store({
  plugins: [
    syncStorage({})
  ],
  state: {
    isCollapse: true
  },
  getters: {
    isShowLayout: (state) => {
      return Router.app._route.path !== '/';
    },
    getLayoutStyle: (state) => {
      if (Router.app._route.path === '/') {
        return {
          top: '28px'
        };
      } else {
        return {
          top: '51px'
        };
      }
    }
  },
  mutations: {
    // 设置菜单栏是否显示
    setCollapse: (state, payload) => {
      state.isCollapse = payload;
    }
  },
  actions: {},
  modules: {
    examine,
    functions,
    matlab,
    user
  }
});
